package com.zhike.controller;


import java.text.ParseException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.zhike.model.ClockRecord;
import com.zhike.model.Users;
import com.zhike.service.UserService;


@Controller
public class UserController {

	@Autowired
	UserService userService;

	
	/**
	 * 用户登陆
	 * @param users
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="api/users",method=RequestMethod.GET,produces="application/json;charset=utf-8")
	private String login(Users users) {
		String str	= userService.login(users);
		return str;
		
	}
	/**
	 * 人员列表
	 */
	@ResponseBody
	@RequestMapping(value="api/members/Get",method=RequestMethod.GET,produces="application/json;charset=utf-8")
	private String members(Users users) {
		String str	= userService.membersList(users);
		return str;
		
	}
	/**
	 * 人员考勤打卡
	 * @throws ParseException 
	 */
	@ResponseBody
	@RequestMapping(value="api/clock",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String clock(ClockRecord clockRecord) throws ParseException {
		String str	= userService.clock(clockRecord);
		return str;
		
	}
	/**
	 * 查询今天打卡状态
	 * @throws ParseException 
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/selectTodayClockDetail",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String clockSelect(ClockRecord clockRecord) throws ParseException {
		String str	= userService.clockSelect(clockRecord);
		return str;
		
	}
	
	/**
	 * 打卡记录
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/selectClockList",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String selectClockList(ClockRecord clockRecord)  {
		String str	= userService.selectClockList(clockRecord);
		return str;
		
	}
	
	/**
	 * 打卡日报
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/team/selectClockDay",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String ClockDay(ClockRecord clockRecord)  {
		String str	= userService.ClockDay(clockRecord);
		return str;
		
	}
	
	/**
	 * 打卡月报
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/team/selectClockMonth",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String ClockMonth(ClockRecord clockRecord)  {
		String str	= userService.ClockMonth(clockRecord);
		return str;
		
	}
	
	/**
	 * 签到明细
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/team/signInDetail",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String signInDetail(ClockRecord clockRecord)  {
		String str	= userService.signInDetail(clockRecord);
		return str;
	}
	
	/**
	 * 每个人当天的打卡记录
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/listToday",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String clockListToday(ClockRecord clockRecord)  {
		String str	= userService.clockListToday(clockRecord);
		return str;
	}
	/**
	 * 每个人这个月的打卡日期记录
	 */
	@ResponseBody
	@RequestMapping(value="api/clock/dateRecord",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String dateRecord(ClockRecord clockRecord)  {
		String str	= userService.dateRecord(clockRecord);
		return str;
	}
	
	/**
	 * 用户和实验室管理系统绑定
	 */
	@ResponseBody
	@RequestMapping(value="api/users/binding",method=RequestMethod.POST,produces="application/json;charset=utf-8")
	private String usersBinding(Users users)  {
		String str	= userService.usersBinding(users);
		return str;
	}
}
